package lab02.test23;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;

public class test2323 {
    public static void main(String[] args) {
        String birthday;//保存生日信息

        System.out.println("Please input your birthday: ");
        Scanner  scanner = new Scanner(System.in);
        birthday =scanner.nextLine();

        /*日期之间计算相差的天数2017-11-10和2017-11-20，这两个字符串无法进行减法运算
        **，2017-11-20->long time 毫秒；
        * （time1-time2）/(24*60*60*1000)*/
        //字符串->simpleDateFormat->Date----calendar---->long
        long  time1=0;
        long time2=0;

        //将字符串转化为日期
        SimpleDateFormat  simpleDateFormat = new SimpleDateFormat("yyyy-mm-dd");
        //simpleDateFormat.parse(birthday)
        //calendar 是抽象类,将时间转化为long
        Calendar  calendar = Calendar.getInstance();//calendar实例化的方式
        time1= calendar.getTimeInMillis();


        long days =(time1-time2)/(24*60*60*1000);
    }
}
